import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';

export const columns: BasicColumn[] = [
  {
    title: 'id',
    dataIndex: 'id',
    align: 'center',
    ifShow: false,
    width: 200,
  },
  {
    title: '救助类型',
    dataIndex: 'type',

    align: 'center',
    width: 200,
  },
  {
    title: '申请状态',
    dataIndex: 'status',

    customRender: ({ record }) => {
      const options = [
        {
          label: '已通过',
          value: '已通过',
        },
        {
          label: '审核中',
          value: '审核中',
        },
        {
          label: '已驳回',
          value: '已驳回',
        },
      ];
      return options.find((op) => op.value === record.status)?.label || '暂无';
    },
    align: 'center',
    width: 200,
  },
  {
    title: '申请原因',
    dataIndex: 'reason',

    align: 'center',
    width: 200,
  },
  {
    title: '申请材料',
    dataIndex: 'file',

    align: 'center',
    width: 200,
  },
  {
    title: '救助金额',
    dataIndex: 'money',

    align: 'center',
    width: 200,
  },
  {
    title: '救助级别',
    dataIndex: 'level',

    align: 'center',
    width: 200,
  },
  {
    title: '申请人',
    dataIndex: 'applicant',

    align: 'center',
    width: 200,
  },
  {
    title: '创建时间',
    dataIndex: 'dateCreated',

    align: 'center',
    width: 200,
  },
  {
    title: '创建人',
    dataIndex: 'createdByName',

    align: 'center',
    width: 200,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'type',
    label: '救助类型',
    component: 'Input',
    componentProps: {
      placeholder: '请输入救助类型',
    },
    colProps: { span: 6 },
  },
  {
    field: 'status',
    label: '申请状态',
    component: 'Select',
    componentProps: {
      placeholder: '请选择申请状态',
      options: [
        {
          label: '已通过',
          value: '已通过',
        },
        {
          label: '审核中',
          value: '审核中',
        },
        {
          label: '已驳回',
          value: '已驳回',
        },
      ],
    },
    colProps: { span: 6 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'id',
    label: 'id',
    component: 'Input',
    show: false,
    required: false,
    componentProps: {
      disabled: false,
      placeholder: '请输入id',
    },
    colProps: { span: 12 },
  },
  {
    field: 'applicant',
    label: '申请人',
    component: 'Input',
    show: true,
    required: true,

    componentProps: {
      disabled: false,
      placeholder: '请输入申请人',
    },
    colProps: { span: 24 },
  },
  {
    field: 'type',
    label: '救助类型',
    component: 'Select',
    show: true,
    required: true,

    componentProps: {
      disabled: false,
      //失业、疾病、老龄、残疾
      placeholder: '请输入救助类型',
      options: [
        {
          label: '失业',
          value: '失业',
        },
        {
          label: '疾病',
          value: '疾病',
        },
        {
          label: '老龄',
          value: '老龄',
        },
        {
          label: '残疾',
          value: '残疾',
        },
        {
          label: '其他',
          value: '其他',
        },
      ],
    },
    colProps: { span: 24 },
  },
  {
    field: 'status',
    label: '申请状态',
    component: 'Select',
    show: false,
    required: false,

    componentProps: {
      disabled: false,
      placeholder: '请选择申请状态',
      options: [
        {
          label: '已通过',
          value: '已通过',
        },
        {
          label: '审核中',
          value: '审核中',
        },
        {
          label: '已驳回',
          value: '已驳回',
        },
      ],
    },
    colProps: { span: 24 },
  },

  {
    field: 'money',
    label: '救助金额',
    component: 'Input',
    show: true,
    required: true,

    componentProps: {
      disabled: false,
      placeholder: '请输入救助金额',
    },
    colProps: { span: 24 },
  },
  {
    field: 'level',
    label: '救助级别',
    component: 'Select',
    show: false,
    required: false,

    componentProps: {
      disabled: false,
      placeholder: '请输入救助级别',
      options: [
        {
          label: '一级',
          value: '一级',
        },
        {
          label: '二级',
          value: '二级',
        },
        {
          label: '三级',
          value: '三级',
        },
        {
          label: '四级',
          value: '四级',
        },
      ],
    },
    colProps: { span: 24 },
  },

  {
    field: 'reason',
    label: '申请原因',
    component: 'InputTextArea',
    show: true,
    required: true,

    componentProps: {
      disabled: false,
      placeholder: '请输入申请原因',
    },
    colProps: { span: 24 },
  },
  {
    field: 'files',
    label: '申请材料',
    component: 'Input',
    show: true,
    slot: 'file',
    componentProps: {
      disabled: false,
      // maxSize: '20',
      // maxNumber: '5',
      // accept: "['.doc,', 'docx', 'application/msword', 'image/*']",
    },
    colProps: { span: 24 },
  },
  {
    field: 'createdByName',
    label: '创建人',
    component: 'Input',
    show: false,
    required: false,
    colProps: { span: 24 },
  },
  {
    field: 'createdBy',
    label: '创建人id',
    component: 'Input',
    show: false,
    required: false,
    colProps: { span: 24 },
  },
  {
    field: 'dateCreated',
    label: '创建时间',
    component: 'Input',
    show: false,
    required: false,
    colProps: { span: 24 },
  },
];
